var xlBook = xls.Workbooks.Open("http://you.com/\PrintTemplates\\xsxycjb.xls");  
var xlsheet = xlBook.Worksheets(1);



function MakeExcel(Obj,ProceVisible,SaveAsFilename,SortType,SortField){  
	var MyData= new GetTableData(Obj,0,0);  
	var myrows=MyData.rows;  
	var i,j;  
	 
	    try {  
	      var xls    = new ActiveXObject ( "Excel.Application" );  
	     }  
	    catch(e) {  
	         alert( "要打印该表，您必须安装Excel电子表格软件，同时浏览器须使用“ActiveX 控件”，您的浏览器须允许执行控件。 请点击【帮助】了解浏览器设置方法！");  
	              return "";  
	     }  
	      if (typeof(ProceVisible)=="undefined"){  
	     xls.visible = true;  
	     }  
	      else{  
	         if (ProceVisible=="true"){  
	           xls.visible = true;  
	           }  
	           else 
	            {  
	            xls.visible = false;  
	         }  
	       }  
	    var xlBook = xls.Workbooks.Add;  
	    var xlsheet = xlBook.Worksheets(1);  
	    xls.Cells.Select;  
	    xls.Selection.NumberFormatLocal = "@";  
	    for (i=0;i     for (j=0;j       if (typeof(MyData.GetFieldData(j)) == "number"){  
	       xlsheet.Cells(i+1,j+1).NumberFormatLocal = "0.00_ ";  
	       }  
	       xlsheet.Cells(i+1,j+1).Value= MyData.GetFieldData(j);  
	     }  
	       
	     MyData.MoveNext();   
	    }  
	      
	     if (SaveAsFilename=="" || typeof(SaveAsFilename)=="undefined"){  
	      var fname = xls.Application.GetSaveAsFilename("*.xls", "Excel Spreadsheets (*.xls), *.xls");  
	      if (fname!=""){  
	      xlBook.SaveAs(fname);  
	      }  
	     }  
	     else{  
	     xlBook.SaveAs(SaveAsFilename);  
	     }  
	    xlBook.Close (savechanges=false);  
	    //xls.visible = false;  
	    xls.Quit();  
	    xls=null;  
	    //结束excel进程，退出完成  
	    window.setInterval("Cleanup();",1);  
	      
	}  